#指定CMAKE版本
cmake_minimum_required(VERSION 3.12.4)

#指定项目名称
project(LVGL_CMake)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_STANDARD 99)
#set(CMAKE_C_FLAGS "-m32" CACHE STRING "C flags" FORCE)
set(CMAKE_TOOLCHAIN_FILE /usr/local/arm/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf)
set(CMAKE_C_COMPILER ${CMAKE_TOOLCHAIN_FILE}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CMAKE_TOOLCHAIN_FILE}/bin/arm-linux-gnueabihf-gcc)
include_directories(${PROJECT_SOURCE_DIR})

add_executable(main main.c)

file(GLOB_RECURSE LVGL_LIB "src/lvgl/**/*.c")
file(GLOB_RECURSE LV_DRV_LIB "src/lv_drivers/**/*.c")
file(GLOB_RECURSE LV_GUI_LIB "ui/**/*.c")

#set(SOURCES ${LVGL_LIB} ${LV_DRV_LIB})
set(SOURCES ${LV_GUI_LIB} ${LVGL_LIB} ${LV_DRV_LIB}  main.c)

#add_executable(main ${SOURCES})
target_sources(main PRIVATE ${LV_GUI_LIB} ${LVGL_LIB} ${LV_DRV_LIB})

target_include_directories(main PRIVATE
    ${PROJECT_SOURCE_DIR}/ui
    ${PROJECT_SOURCE_DIR}/src/lvgl
    ${PROJECT_SOURCE_DIR}/src/lv_drivers
)
